package com.lijian.dubbo.consumer.action;

import java.util.Date;

import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.lijian.dubbo.listener.MyListener;
import com.lijian.dubbo.service.CallbackService;

@Component
public class CallBackUserAction {

	@Reference
	CallbackService callbackService;
	
	public void callBack(String key){
		System.out.println("开始调用:"+new Date().toString());
		callbackService.addListener(key, new MyListener() {
			
			public void changed(String msg) {
				System.out.println("这是回调的内容:"+msg);
			}
		});
		System.out.println("结束调用:"+new Date().toString());
	}
}
